﻿using Khrulenko___Lukyanov_WPF;
using System;
using System.Windows;
using System.Windows.Controls;


namespace WpfLoginApp
{
    public partial class MainWindow : Window
    {
        public string UserName { get; set; }
        public string UserWeight { get; set; }
        public string UserHeight { get; set; }
        public string UserVozrast { get; set; }
        public string UserIMT { get; set; }
        public string UserMeta { get; set; }

        public MainWindow()
        {
            InitializeComponent();
            LoginButton.Click += LoginButton_Click;
            RegisterButtonMain.MouseLeftButtonDown += RegisterTextBlock_Click;
        }

        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            if (IsLoginSuccessful())
            {
                Window2 window2 = new Window2();
                window2.UserName = LoginTextBox.Text;
                window2.UserWeight = WeightBlock.Text;
                window2.UserHeight = UserHeight.Text;
                window2.UserVozrast = VozrastUser.Text;
                window2.UserIMT = UserIMT.Text;
                window2.UserMeta = UserMeta.Text;
                window2.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Неверный логин или пароль");
            }
        }

        private void RegisterTextBlock_Click(object sender, RoutedEventArgs e)
        {
            Window1 registrationWindow = new Window1();
            this.Close();
            registrationWindow.Show();
            
            
        }

        private bool IsLoginSuccessful()
        {
            string expectedLogin = "123";
            string expectedPassword = "123";
            return LoginTextBox.Text == expectedLogin && PasswordBox.Password == expectedPassword;
        }
    }
}